#coding=utf-8
# @Time :2021/4/11 9:16 上午
# @Author : Jelly
# @File : qqq.py
# @Software : PyCharm


import random
def func(cls):
    instance = {}
    def wapper():
        if cls not in instance:
            instance[cls] = cls()
        return instance[cls]
    return wapper


@func
class A:
    pass


a = A()
print(id(a))
a1 = A()
print(id(a1))